package com.yourenbang.transaction.api.service.fund;

import com.yourenbang.lingyun.constants.enums.ServiceNameConstants;
import com.yourenbang.lingyun.core.message.Result;
import com.yourenbang.lingyun.domain.FundAccount;
import com.yourenbang.transaction.api.model.dto.fund.*;
import com.yourenbang.transaction.api.model.vo.fund.FundQueryVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

@FeignClient(value = ServiceNameConstants.SERVICE_TRANSACTION)
@RequestMapping("/service/fund/api")
public interface FundApiService {

    /**
     * 查询用户所有账户
     */
    @RequestMapping("/query/all/fund")
    Result<Map<Integer, FundQueryVO>> queryAllFund(@RequestBody FundQueryDTO fundQueryDTO);

    /**
     * 查询用户指定账户
     */
    @RequestMapping("/query/one/fund")
    Result<FundQueryVO> queryOneFund(FundQueryOneDTO fundQueryOneDTO);

    /**
     * 查询用户的各项收入
     */
    @RequestMapping("/query/user/earning")
    Result<List<MonthEarningDataVO>> queryUserAccountDetail(@RequestBody QueryUserAccountDetailDTO dto);

    /**
     * 创建boss账户,如已存在不再创建
     *
     * @param dto
     * @return
     */
    @RequestMapping("/add/boss")
    Result<List<FundAccount>> bossAccountAddIfNotExist(@Validated @RequestBody FundAddParamsDTO dto);

    /**
     * 创建盟友资金账户,如已存在,不再创建
     *
     * @param dto
     * @return
     */
    @RequestMapping("/add/ally")
    Result<List<FundAccount>> allyAccountAddIfNotExist(@Validated @RequestBody FundAddParamsDTO dto);

    /**
     * 创建商户资金账户,如已存在,不再创建
     *
     * @param dto
     * @return
     */
    @RequestMapping("/add/merchant")
    Result<List<FundAccount>> merchantAccountAddIfNotExist(@Validated @RequestBody FundAddParamsDTO dto);

    /**
     * 取消资金变动计划
     *
     * @param orderNo 订单号
     * @return
     */
    @RequestMapping("/cancel/change/plan")
    Result cancelByOrderNo(@RequestParam("orderNo") String orderNo);

}
